<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>position定位</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            border: 2px solid red;
        }
        .d1{
            border: 2px;
            background-color: #5bc0de;
            position: static;
        }
        .d2{
            border: 2px;
            background-color: #eea236;
            position: static;
        }
        .d3{
            border: 2px;
            background-color: #5cb85c;
        }
        .d4{
            border: 2px;
            background-color: #ac2925;
        }
        div:hover{
            /*通过外边距移动元素,会导致其他元素跟着动*/
            /*margin: 30px 0 0 30px;*/
            /*通过相对定位可以实现只移动某个元素,其他元素不受影响*/
            position: relative;
            top:30px;
            left: 30px;
        }

    </style>
</head>
<body>
    <div class="d1">div1</div>
    <div class="d2">div2</div>
    <div class="d3">div3</div>
    <div class="d4">div4</div>
</body>
</html>